/**
 * @author Graziano Felline
 */

function TrovamiVicino() {
    navigator.geolocation.getCurrentPosition(handle_geolocation_queryVicino, handle_errors);
}

function TrovamiRaggio() {
    navigator.geolocation.getCurrentPosition(handle_geolocation_queryRaggio, handle_errors);
}

function handle_geolocation_queryVicino(position) {
   
    $("#lat").val(position.coords.latitude);
    $("#long").val(position.coords.longitude);


}

function handle_geolocation_queryRaggio(position) {

    $("#latr").val(position.coords.latitude);
    $("#longr").val(position.coords.longitude);

}

function aggiungimarker(tipo) {
    var DoveCercare = $(".ui-selected").html();
    var parametri = new Array();
    if(tipo=="R"){
    parametri[0] = $("#latr").val();
    parametri[1] = $("#longr").val();
    parametri[2] = $("#raggio").val();
    }
else{
       parametri[0] = $("#lat").val();
    parametri[1] = $("#long").val();
    parametri[2] = $("#max").val();
    
    
}

    var point = new google.maps.LatLng(parametri[0], parametri[1]);
    var marker = new google.maps.Marker({
        position : point,
        title : "Tu sei Qui",
        setIcon : "http://googlemaps.googlermania.com/google_maps_api_v3/en/Google_Maps_Marker.png"

    });
    inizializzaNarratore(DoveCercare, tipo, parametri, marker);
}

function handle_errors(error) {
}